package com.shujia.day09;

import java.util.Scanner;

abstract class Pizza {
    private String name;
    private int size;
    private int price;

    public Pizza() {
    }

    public Pizza(String name, int size, int price) {
        this.name = name;
        this.size = size;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public abstract void show();

}

class PGPizza extends Pizza {

    int numG;

    public PGPizza(int size, int price, int numG) {
        super("培根披萨", size, price);
        this.numG = numG;
    }


    @Override
    public void show() {
        System.out.println("名称:" + getName());
        System.out.println("价格:" + getPrice());
        System.out.println("大小:" + getSize());
        System.out.println("培根克数:" + numG);
    }
}


class HXPizza extends Pizza {

    String dosing;

    public HXPizza(int size, int price, String dosing) {
        super("海鲜披萨", size, price);
        this.dosing = dosing;
    }

    @Override
    public void show() {
        System.out.println("名称:" + getName());
        System.out.println("价格:" + getPrice());
        System.out.println("大小:" + getSize());
        System.out.println("配料：" + dosing);
    }
}


public class H1PizzaOperator {
    public static void main(String[] args) {

        /*
            1、接受用户的输入
         */

        Scanner scanner = new Scanner(System.in);

        System.out.println("请选择要制作的pizza(1.培根披萨 2.海鲜披萨):");
        int i = scanner.nextInt();
        if (i == 1) {
            // 培根
            System.out.println("请输入披萨的克数：");
            int numG = scanner.nextInt();
            System.out.println("请输入披萨的大小：");
            int size = scanner.nextInt();
            System.out.println("请输入披萨的价格：");
            int price = scanner.nextInt();

            new PGPizza(size, price, numG).show();

        } else if (i == 2) {
            // 海鲜
            System.out.println("请输入配料表：");
            String dosing = scanner.next();

            System.out.println("请输入披萨的大小：");
            int size = scanner.nextInt();
            System.out.println("请输入披萨的价格：");
            int price = scanner.nextInt();
            new HXPizza(size,price,dosing).show();

        } else {
            System.out.println("输入错误");
        }


    }
}
